package com.woniuxy.mybatisstudy.entity;

import com.baomidou.mybatisplus.annotation.*;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import lombok.experimental.Accessors;

import java.util.Date;

/**
 * @Author: linKe
 * @Date: 2021/11/23 18:43
 * @FileName: User
 * @version: 1.0
 * @Description: 描述
 */
@Data
@AllArgsConstructor
@NoArgsConstructor
@Accessors(chain = true)
public class User {
    /**
     * 设置id自增
     * ASSIGN_ID 分配id
     */
    @TableId(type= IdType.AUTO)
    private  long id;
    private String name;
    private  Integer age;
    private String email;

    /**
     * 增加乐观锁
     */
    @Version
    private Integer version;

    /**
     *  插入操作    时间生效
     */
    @TableField(fill = FieldFill.INSERT)
    private Date createTime;
    /**
     * 插入更新     时间生效
     */
    @TableField(fill = FieldFill.INSERT_UPDATE)
    private Date updateTime;
}
